﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using YJYpublicClass;

namespace YJYpublicClass
{
    public partial class Frm_登录 : Form
    {
        public Frm_登录()
        {
            InitializeComponent();
        }

        private void AdminForm_Load(object sender, EventArgs e)
        {
            comUserName.SelectedIndex = 0;

            Rectangle Rect = new Rectangle();
            Rect = Screen.GetWorkingArea(this);    //显示器分辨率
            int FormHeight = this.Height;          //窗体大小
            int FormWidth = this.Width;
            this.Location = new System.Drawing.Point((Rect.Width - FormWidth) / 2, (Rect.Height - FormHeight) / 2);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            //技术员登录
            if (comUserName.SelectedIndex == 0)
            {
                if (txtPassWord.Text == "123")
                {
                    PublicValue.LoginRight = 2;
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("密码错误,请重新输入！");
                }
            }

            //最高权限
            if (comUserName.SelectedIndex == 1)
            {
                if (txtPassWord.Text == "321")
                {
                    PublicValue.LoginRight = 3;
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("密码错误,请重新输入！");
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
